import AdminApiActions from "@/api/admin-api-actions";
import type { SpuSearchParams ,SpuItem } from "@/api/types"
import { ref, type Ref } from 'vue'
export const useProduct = ()=>{

    /**
     * 商品列表数据
     */
    const productList:Ref<SpuItem[]> = ref([]);

    /**
     * 获取商品列表
     */
    const getProductList = async () => {
        let params:SpuSearchParams={
            name:"",
            pager:{
                currentPage:1,
                pageSize:10
            }
        } 
        let spuList:SpuItem[] = await AdminApiActions.getSpuList(params);
        productList.value = spuList;
    }
    
    getProductList();

    return {
        productList
    }
}